home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
LOGIC Apps
/
Logic-APPLE_II_APPS.iso
/
mac
/
LOGIC Apple II 5.25" Library - ProDOS
/
PROPROG.dsk
/
TYPE.CHANGER.bas
< prev
Wrap
BASIC Source File
|
2012-02-16
|
12KB
|
282 lines
1 REM +-----------------+
2 REM |PRODOS FILE TYPE |
3 REM |CHANGER. (C) 1986|
4 REM |PROSOFT SOFTWARE |
5 REM |AUTHOR: |
6 REM | JIM MENSCH |
7 REM |THIS PROGRAM IS |
8 REM |FREE FOR USE.... |
9 REM +-----------------+
10 REM PRODOS FILE TYPE CHANGER
11 LOMEM: 4 *4096 +512: REM $4200
12 DIM Q$(768): REM error messages and file types
15 PRINT CHR$(4);"PR#3"
20 POKE 768,32: POKE 769,0: POKE 770,191: POKE 771,196: POKE 772,0: POKE 773,64: POKE 774,133: POKE 775,255: POKE 776,96
25 REM SET UP VARIABLE NAMES
26 PARMCOUNT = 16384: REM PARAMETER COUNT
27 PNAME = 16385: REM PATHNAME
28 ACCESS = 16387: REM ACCESS ATRIBUTE
29 FTYPE = 16388: REM PRODOS FILE TYPE
30 AUXTYPE = 16389: REM AUX TYPE
31 STYPE = 16391: REM STORAGE TYPE
32 BUSED = 16392: REM BLOCKES USED
33 MDTE = 16394: REM MODIFIED DATE
34 MTIME = 16396: REM MOD TIME
35 CDTE = 16398: REM CREATE DATE
36 CTIME = 16400: REM CREATE TIME
37 PBUF = 16640
38 CMMD = 771
40 REM SET UP PATH NAME PARMS
41 POKE PNAME,0: POKE PNAME +1,65: REM SET PATH NAME BUFFER TO 16640
99 GOTO 5000: REM MAIN PROGRAM LOOP
100 REM GET FILE INFO
110 L = LEN(P$): REM GET LENGTH OF PATH NAME
115 IF L <1 THEN P$ = "&BADPATH": GOTO 110
120 POKE PBUF,L
130 FOR X = 1 TO L: POKE PBUF +X, ASC( MID$ (P$,X,1)): NEXT X: REM STORE THE PATH NAME
140 POKE PARMCOUNT,10: REM PARM COUNT FOR GET FILE INFO
150 POKE CMMD,196: REM COMMAND NUMBER FOR GFI
160 CALL 768: REM NOW GO GET THE FILE INFO!
170 IF PEEK(255) < >0 THEN 12100
180 RETURN
200 REM NOW SET THE NEW FILE TYPE...
205 POKE CMMD,195: REM SET FILE INFO COMMAND
210 POKE PARMCOUNT,7: REM THE INFO IS ALREADY THERE SO WE JUST CALL THE STUFF
220 CALL 768
230 RETURN
240 IF PEEK(255) < >0 THEN 12100
300 REM fill q$ array with data...
310 FOR X = 0 TO 512
320 Q$(X) = " Unknown"
330 NEXT X
340 READ A,A$
350 IF A = -1 THEN 390
360 Q$(A) = A$
370 GOTO 340
390 RETURN
500 REM get new file type
510 CT = PEEK(FTYPE): IF FI = 1 THEN CT = 513: REM CT equals current type or file
520 VTAB 7
530 POKE 34,6: POKE 35,19
535 HOME
540 FOR CL = CT -6 TO CT +6
546 VTAB (CL -(CT -6)) +7
550 GOSUB 900
560 NEXT CL
570 INVERSE
580 GOSUB 930
590 NORMAL
600 REM
605 GET KEY$
610 IF KEY$ = CHR$(11) THEN 700: REM move up
615 IF KEY$ = CHR$(10) THEN 745: REM move down
620 IF KEY$ = CHR$(13) THEN TEXT : RETURN
624 ES = 0: IF KEY$ = CHR$(27) THEN ES = 1: TEXT : RETURN
626 IF KEY$ = " " AND FI THEN ES = 2: TEXT : RETURN
630 GOTO 570
698 VTAB 22
699 GET KEY$
700 REM move up
705 GOSUB 930
710 IF CT = 0 OR CT = 513 THEN PRINT "<CTRL-G>";: GOTO 570
715 PRINT CHR$(22);
717 IF CT = 233 THEN CT = 206: GOTO 520
719 IF CT = 170 THEN CT = 33: GOTO 520
720 CT = CT -1
725 VTAB 7: POKE 36,0: POKE 1403,0:CL = CT -6
730 GOSUB 900
735 GOTO 570
745 GOSUB 930
750 IF CT = 255 OR CT = NF +512 THEN PRINT "<CTRL-G>";: GOTO 570
755 PRINT CHR$(23);
757 IF CT = 33 THEN CT = 170: GOTO 520
759 IF CT = 206 THEN CT = 233: GOTO 520
760 CT = CT +1
765 VTAB 19: POKE 36,0: POKE 1403,0:CL = CT +6
770 GOSUB 900
775 GOTO 570
900 REM print the proper string on current line
901 IF (CL >255 AND CL <513) OR CL >NF +512 THEN RETURN
905 NUM$ = RIGHT$(" " + STR$(CL) +" ",5)
910 IF CL > -1 THEN PRINT MID$ (NUM$,1,5 *( NOT FI));Q$(CL); CHR$(29);
915 POKE 36,0: POKE 1403,0
920 RETURN
925 REM Print the center string....
930 VTAB 13: POKE 36,0: POKE 1403,0
931 CL = CT
935 GOTO 900
999 RETURN
1000 REM Get a ProDOS catalog of this area
1010 PRINT CHR$(4);"PREFIX": INPUT PFX$
1020 PRINT CHR$(4);"OPEN ";PFX$;",T15"
1030 PRINT CHR$(4);"READ ";PFX$
1040 INPUT S$: INPUT T$: INPUT S$
1050 FOR K = 513 TO 768: INPUT S$
1060 IF S$ = "" THEN 1090
1070 Q$(K) = LEFT$(S$,80)
1080 NEXT
1090 PRINT CHR$(4);"CLOSE"
1100 NF = K -513: REM No. of files this directory
1110 RETURN
1200 REM Get the name of the file to be changed
1210 GOSUB 1000: REM Read the directory
1220 VTAB 4: PRINT "Prefix:";PFX$; CHR$(29)
1225 PRINT T$
1230 ES = 0:FI = 1: GOSUB 500:FI = 0: REM Get the filename
1240 F$ = "": FOR I = 2 TO 16:X$ = MID$ (Q$(CT),I,1): IF X$ < >" " THEN F$ = F$ +X$
1250 NEXT :P$ = PFX$ +F$
1260 IF ES = 1 THEN TEXT : HOME : PRINT CHR$(4);"prefix";OPFX$: END
1270 IF ES = 2 THEN PRINT CHR$(4);"PREFIX/": VTAB 4: GOTO 1210
1280 IF MID$ (Q$(CT),18,3) = "DIR" THEN PRINT CHR$(4);"PREFIX";P$: VTAB 4: GOTO 1210
1299 RETURN
5000 REM MAIN PROGRAM LOOP
5003 PRINT CHR$(4);"PREFIX": INPUT OPFX$
5005 GOSUB 6000: REM PRINT STARTUP AND DISCLAIMER
5007 GOSUB 300: REM BUILD TABLE
5008 INPUT "Press RETURN to continue";A$
5010 HOME
5015 ONERR GOTO 12000
5020 PRINT "ProDOS File Type Changer V 1.2 05-11-87"
5030 PRINT "By Jim Mensch (c) 1986 ProSoft Software Esc: Quit"
5040 PRINT "------------------------------------------------------------------------------"
5050 VTAB 20: PRINT "------------------------------------------------------------------------------"
5051 VTAB 20: PRINT : PRINT "Use Up and Down arrow keys to change selection. Press RETURN to select"
5052 PRINT "file to be changed. Press SPACE to return to root directory. "
5060 GOSUB 1200: REM Get File
5065 VTAB 2: POKE 1403,67: PRINT "Select File"
5070 VTAB 4: PRINT "File:";F$; CHR$(29)
5080 GOSUB 100
5090 PRINT "Type:";Q$( PEEK(FTYPE)); CHR$(29)
5091 VTAB 20: PRINT : PRINT "Use Up and Down arrow keys to change selection. Press RETURN to change"
5092 PRINT "file to the type selected. NOTE This will not alter the contents of the file"
5100 GOSUB 500: REM get new file type
5103 IF ES = 1 THEN 5010
5105 VTAB 22: PRINT CHR$(26);
5110 VTAB 20: PRINT : PRINT
5111 INPUT "Value for AuxType: ";Q1$
5112 Q1 = VAL(Q1$):NA = 0: IF Q1$ = "" THEN NA = 1: VTAB 21: PRINT : HTAB 20: PRINT "Original Value"
5120 PRINT "Type 'YES' to save change:"; CHR$(29);
5125 INPUT "";A$
5130 IF A$ = "YES" OR A$ = "yes" THEN 5500
5140 GOTO 5010
5500 POKE FTYPE,CT
5504 IF NA = 1 THEN 5510
5505 POKE AUXTYPE +1, INT(Q1/256)
5506 POKE AUXTYPE,Q1 -( PEEK(AUXTYPE +1) *256)
5510 GOSUB 200
5520 VTAB 20: PRINT
5530 PRINT "Type Changed!!!!! (Strike any key)"; CHR$(11);: GET KEY$
5540 GOTO 5010
5999 END
6000 TEXT : HOME
6010 PRINT "PRODOS FILE TYPE CHANGER"
6020 PRINT "BY JIM MENSCH"
6030 PRINT "This program will let you change the File Type of any ProDOS files"
6040 PRINT "Just type the complete pathname of the file that you want to change"
6050 PRINT "and you will be prompted for the new type. If you have any problems"
6060 PRINT "EMail me on GEnie (ADDRS:MENSCH)."
6070 PRINT "Note this program could be hazardous when used incorrectly. Always"
6080 PRINT "backup your disks! I charge to do data recovery if you blow your disks!"
6090 PRINT
9100 PRINT "This program brought to you by ProSoft Software. We write the software"
9110 PRINT "that makes the grape jelly purple!"
9120 PRINT "Note: This program is freeware so you are not OBLIGATED to send me"
9130 PRINT "One Buck in small unmarked bills. That address is 225 Union #232A"
9140 PRINT "Campbell CA 95008. However, you are NOT RESTRICTED from doing so either!"
9150 PRINT
9160 RETURN
10000 DATA 00,"$00 Typeless file (SOS and ProDOS)"
10001 DATA 01,"BAD Bad Block file"
10002 DATA 02,"PCD Pascal Code file (SOS)"
10003 DATA 03,"PTX Pascal Text file (SOS)"
10004 DATA 04,"TXT ASCII Text file (SOS and ProDOS)"
10005 DATA 05,"PDA Pascal Data File (SOS)"
10006 DATA 06,"BIN General Binary file (SOS and ProDOS)"
10007 DATA 07,"FNT Font file (SOS)"
10008 DATA 08,"FOT Graphics Screen file"
10009 DATA 09,"BA3 Business Basic Program file (SOS)"
10010 DATA 10,"DA3 Business Basic Data file (SOS)"
10011 DATA 11,"WPF Word Processor file"
10012 DATA 12,"SOS SOS System file"
10013 DATA 13,"$0D RESERVED - SOS"
10014 DATA 14,"$0E RESERVED - SOS"
10015 DATA 15,"DIR Directory file (SOS and ProDOS)"
10016 DATA 16,"RPD RPS Data file"
10017 DATA 17,"RPI RPS Index file"
10018 DATA 18,"AFD AppleFile Discard file"
10019 DATA 19,"AFM AppleFile Model file"
10020 DATA 20,"AFR AppleFile Report Format file"
10021 DATA 21,"SCL Screen Library file (SOS)"
10022 DATA 22,"$16 RESERVED - SOS"
10023 DATA 23,"$17 RESERVED - SOS"
10024 DATA 24,"$18 RESERVED - SOS"
10025 DATA 25,"ADB Appleworks Data Base file {/// EZ pieces}"
10026 DATA 26,"AWP Appleworks Word Proc. file {/// EZ pieces}"
10027 DATA 27,"ASP Appleworks Spreadsheet file {/// EZ pieces}"
10176 DATA 176,"SRC APW Source file"
10177 DATA 177,"OBJ APW Object file"
10178 DATA 178,"LIB APW Library file"
10179 DATA 179,"S16 ProDOS 16 Application Program file"
10180 DATA 180,"RTL APW Run Time Library file"
10181 DATA 181,"EXE ProDOS 16 Shell Application file"
10182 DATA 182,"STR ProDOS 16 Startup Load file (Permanent)"
10183 DATA 183,"$B7 ProDOS 16 Startup Load file (Removable)"
10184 DATA 184,"NDA New Desk Accessory file"
10185 DATA 185,"CDA Classic Desk Accessory file"
10186 DATA 186,"$BA System Tool file"
10187 DATA 187,"$BB RESERVED - ProDOS 16 Load file"
10188 DATA 188,"$BC RESERVED - ProDOS 16 Load file"
10189 DATA 189,"$BD RESERVED - ProDOS 16 Load file"
10190 DATA 190,"$BE RESERVED - ProDOS 16 Load file"
10191 DATA 191,"$BF ProDOS 16 Document file"
10192 DATA 192,"$C0 Paintworks file"
10193 DATA 193,"$C1 Paintworks file"
10200 DATA 200,"$C8 ProDOS 16 Font file"
10239 DATA 239,"PAS Pascal Area on partitioned disk"
10240 DATA 240,"CMD ProDOS 8 Command file"
10241 DATA 241,"$F1 ProDOS User Defined 1"
10242 DATA 242,"$F2 ProDOS User Defined 2"
10243 DATA 243,"$F3 ProDOS User Defined 3"
10244 DATA 244,"$F4 ProDOS User Defined 4"
10245 DATA 245,"$F5 ProDOS User Defined 5"
10246 DATA 246,"$F6 ProDOS User Defined 6"
10247 DATA 247,"IMG ProDOS User Defined 7 (Copy II Plus Image file)"
10248 DATA 248,"$F8 ProDOS User Defined 8"
10249 DATA 249,"$F9 ProDOS 16"
10250 DATA 250,"INT Integer BASIC Program file"
10251 DATA 251,"IVR Integer BASIC Variable file"
10252 DATA 252,"BAS Applesoft Program file"
10253 DATA 253,"VAR Applesoft Variable file"
10254 DATA 254,"REL Relocatable Code file (EDASM)"
10255 DATA 255,"SYS ProDOS System file"
11000 REM errors start here
11001 DATA 257,"Bad system call number"
11004 DATA 260,"Bad system call parameter count"
11025 DATA 293,"Interupt vector table full"
11027 DATA 295,"I/O error"
11028 DATA 299,"Disk write protected"
11029 DATA 320,"Invalid pathname syntax"
11030 DATA 324,"Path not found"
11031 DATA 325,"Volume directory not found"
11032 DATA 326,"File not found"
11033 DATA 330,"Incompatible file format"
11034 DATA 331,"Unsupported storage_type"
11035 DATA 334,"Access error: file not write enabled"
11036 DATA 339,"Invalid value in parameter list"
11037 DATA 346,"Bit map disk address is impossible"
11100 DATA -1,""
12000 REM error handling routine...
12010 REM this routine reports the error then restarts program
12011 POKE 216,0
12020 CALL 54915: REM clear off the stack and start fresh
12030 VTAB 20: PRINT
12035 TEXT
12040 PRINT CHR$(26);"ERROR:"; PEEK(222);" in line "; PEEK(218) +256 * PEEK(219);" Press <RETURN> to continue";
12050 INPUT "";A$
12060 GOTO 12999: REM and end this one
12100 REM ProDOS error handler here
12110 VTAB 20: PRINT
12120 PRINT CHR$(26);"ERROR:";Q$( PEEK(255) +256)
12130 INPUT "Press Return to continue:";A$
12140 CALL 54915: REM and clear off stack
12999 GOTO 5010: REM end error handler